#include <stdio.h>
void swap(void *input,int num,void *output)
{
    unsigned char tmp[num];
    int i;
    for(i=0;i<num;i++)
    {
        tmp[i] = *((unsigned char *)input + i);
    }
    for(i=0;i<num;i++)
    {
        *((unsigned char *)output + i) = tmp[num-i-1]; 
    }

}
int main(void)
{
    long a = 0x12345678;
    unsigned char b[10] = {1,2,3,4,5,6,7,8,9,0xA};
    long c = 0;
    unsigned char d[10] = {0};

    swap(&a,sizeof(a),&c);
    printf("c=%lx\n",c);
    swap(b,sizeof(b),d);
    int i;
    for(i=0;i<10;i++)
    {
        printf("d[%d] = 0x%X\n",i,d[i]);
    }
    return 0;
}
